<?php
namespace app\api\controller;

use app\common\controller\ApiBase;
use think\facade\Db;

class DataStation extends ApiBase
{

    public function getStationByCity()
    {
        $param = $this->request->param();
        if( empty($param['city']) ){
            return $this->jsonFmt('参数有误');
        }
        $data = [];
        $city = trim($param['city']);
        $list = Db::name('data_station2')->field('name,location,pname,cityname,adname,address')->where('cityname',$city)->select();
        if(empty($list)){
            return $this->jsonFmt('没有相关数据');
        }
        return $this->jsonFmt('请求成功', $list, 1);
    }

}